const program = require('commander');
const ora = require('ora');
const printProgramInfo = require('./info');
const datetime = require('./datetime');

const spinner = ora('正在加载中，请稍后 ...').start();
program
  .option('-t, --time <number>', '等待时间 (秒)', 3)
  .option('-m, --message <string>', '要输出的信息', 'Hello World')
  .parse(process.argv);

  setTimeout(() => {
    spinner.stop();
    console.log(program.message);
  }, program.time * 1000);

printProgramInfo();
console.log('当前时间', datetime.getCurrentTime());
//console.log(process.argv)

process.on('exit', () => {
  console.log('下次再见~');
});

//  node timer.js --message "洪荒之力！" --time 5